<?php $this->headScript()->appendFile($this->JS_PATH . "blog.js");

?><?php $this->headScript()->appendFile($this->BASE_URL . "library/ckeditor/ckeditor.js"); ?>
<?php $this->headScript()->appendFile($this->BASE_URL . "library/ckeditor/adapters/jquery.js"); ?>

<div id="blog-listing"></div>
<?php echo $this->flashmessages(); ?>
<?php if (count($this->errorMessage) > 0): ?>
    <div class="alert alert-error">
        <?php foreach ($this->errorMessage as $erroValue): ?>
            <div class="text-left">
                <i class="icon-remove-sign"></i>
                <?php echo $erroValue; ?>
            </div>

        <?php endforeach; ?>
    </div>
<?php endif; ?><div id="pad-wrapper">
    <div class="row pagelist-header">
        <h3>Blog Listing</h3>
    </div>
    <div class="table-products">
        <form action="" method="post" id="bloglistingfrm">

            <div class="row-fluid ">
                <div class="pull-right">
                    <input type="text" class="search" name="searchtype" value="<?php echo $this->searchtype ?>" >
                    <input type="submit" value="Search" name="searchbutton"  id="searchbutton" class="btn-flat new-product"/>      
                    <a class="btn-flat new-product"
                       href="<?php echo $this->url(array("module" => "admin", "controller" => "blog", "action" => "form"), null, TRUE); ?>"
                       >+ Add New</a>                        
                </div>
            </div>

            <div class="row">
                <?php if (count($this->blogsData) > 0): ?> 
                    <div class="delete_All">    
                        <input type="submit" accesskey="s" value="Delete All" name="multiaction"  id="multiaction" class="btn-flat danger"/>      
                    <?php else: ?>
                        &nbsp;
                    <?php endif; ?>
                </div> <table class="table table-hover">
                    <thead>
                        <tr>
                            <th><input id="selectall" type="checkbox"/></th>                        
                            <th class="col-md-3">

                                <a href="<?php echo $this->url(array('module' => 'admin', "controller" => "blog", "action" => "list", "field" => "blog_title", "sort" => "asc"), null, false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_asc.png"  alt="Ascending" title="Ascending" class="sort_asc" />
                                </a>
                                Title
                                <a href="<?php echo $this->url(array('module' => 'admin', "controller" => "blog", "action" => "list", "field" => "blog_title", "sort" => "desc"), null, false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_desc.png"  alt="Descending" title="Descending" class="sort_desc"  />
                                </a>

                            </th>


                            <th class="col-md-3">
                                <a href="<?php echo $this->url(array('module' => 'admin', "controller" => "blog", "action" => "list", "field" => "blog_description", "sort" => "asc"), null, false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_asc.png"  alt="Ascending" title="Ascending" class="sort_asc" />
                                </a>
                                Description
                                <a href="<?php echo $this->url(array('module' => 'admin', "controller" => "blog", "action" => "list", "field" => "blog_description", "sort" => "desc"), null, false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_desc.png"  alt="Descending" title="Descending" class="sort_desc"  />
                                </a>

                            </th><th class="col-md-3">
                                <a href="<?php echo $this->url(array('module' => 'admin', "controller" => "blog", "action" => "list", "field" => "blog_status", "sort" => "asc"), null, false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_asc.png"  alt="Ascending" title="Ascending" class="sort_asc" />
                                </a>
                                Status
                                <a href="<?php echo $this->url(array('module' => 'admin', "controller" => "blog", "action" => "list", "field" => "blog_status", "sort" => "desc"), null, false); ?>">
                                    <img src="<?php echo $this->IMAGE_PATH; ?>datatables/sort_desc.png"  alt="Descending" title="Descending" class="sort_desc"  />
                                </a>
<span class="cls_action"> Action</span>
                            </th>  </tr>
                    </thead>
                    <tbody>

                        <?php if (count($this->blogsData) > 0): ?>
                            <?php $counter = 0; ?>
                            <?php foreach ($this->blogsData as $key => $value) : ?>
                                <!-- row -->
                                <tr <?php if ($counter == 0): ?>class="first"<?php endif; ?>>
                                    <td><input type="checkbox" class="content-checkbox" name="multicheck[]" value="<?php echo $value["blog_id"]; ?>"/>
                                    </td> <td> 
                                        <a href="<?php echo $this->url(array("module" => "admin", "controller" => "blog", "action" => "form", "blog_id" => $value["blog_id"]), null, true); ?>">
                                            <?php echo $value["blog_title"]; ?>
                                        </a>
                                    </td>
                                    <td> 
                                        <?php  echo substr($value['blog_shortdescription'],0,300)." ..."; ?>
                                    </td>
                                    <td> 
                                        <?php if ($value["blog_status"] == 1): ?>
                                            <span class="label label-success">Active</span>
                                        <?php else:
                                            ?>
                                            <span class="label label-info">InActive</span>
                                        <?php
                                        endif;
                                        ?>
                                               <a title="View Comment" href="<?php echo $this->url(array("module" => "admin", "controller" => "comment", "action" => "list", "blog_id" => $value["blog_id"]), null, true); ?>">
                                                     <span class="label label-info">View Comment</span>
                                               </a>
                                            <ul class="actions">
                                            <li>
                                                <a title="Edit" href="<?php echo $this->url(array("module" => "admin", "controller" => "blog", "action" => "form", "blog_id" => $value["blog_id"]), null, true); ?>">
                                                    <i class="table-edit"></i>
                                                </a>
                                            </li>
                                            <li >
                                                <a title="View" class="view_anchr" href="<?php echo $this->url(array("module" => "admin", "controller" => "blog", "action" => "view", "blog_id" => $value["blog_id"]), null, true); ?>">
                                                    <i class="icon-eye-open"></i>
                                                </a>
                                            </li>
                                            <li class="last">
                                                <a title="Delete" href="<?php echo $this->url(array("module" => "admin", "controller" => "blog", "action" => "delete", "blog_id" => $value["blog_id"]), null, true); ?>">
                                                    <i class="table-delete"></i>
                                                </a>
                                            </li>
                                        </ul>
                                    </td>

                                </tr>
                                <?php $counter++; ?>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <tr class="row2" >
                                <td>&nbsp;</td>
                                <td colspan="8"> No Record Found</td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table></div>
            <?php
            if (count($this->blogsData) > 0):
                echo $this->paginator->displayPages();
            endif;
            ?>
        </form>
    </div>
</div>